using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class ICPurEntryMap : EntityTypeConfiguration<ICPurEntry>
    {
        public ICPurEntryMap()
        {
            // Primary Key
            this.HasKey(t => new { t.FInvoiceID, t.FEntryID });

            // Properties
            this.Property(t => t.FInvoiceID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FEntryID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FExplanation)
                .HasMaxLength(80);

            this.Property(t => t.FBatchNo)
                .HasMaxLength(30);

            this.Property(t => t.FFreeItem1)
                .HasMaxLength(20);

            this.Property(t => t.FFreeItem2)
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("ICPurEntry");
            this.Property(t => t.FInvoiceID).HasColumnName("FInvoiceID");
            this.Property(t => t.FEntryID).HasColumnName("FEntryID");
            this.Property(t => t.FProductID).HasColumnName("FProductID");
            this.Property(t => t.FUnitID).HasColumnName("FUnitID");
            this.Property(t => t.FQuantity).HasColumnName("FQuantity");
            this.Property(t => t.FPrice).HasColumnName("FPrice");
            this.Property(t => t.FPriceFor).HasColumnName("FPriceFor");
            this.Property(t => t.FAmount).HasColumnName("FAmount");
            this.Property(t => t.FAmountFor).HasColumnName("FAmountFor");
            this.Property(t => t.FTax).HasColumnName("FTax");
            this.Property(t => t.FTaxFor).HasColumnName("FTaxFor");
            this.Property(t => t.FTaxRate).HasColumnName("FTaxRate");
            this.Property(t => t.FAmountIncludeTax).HasColumnName("FAmountIncludeTax");
            this.Property(t => t.FAmountIncludeTaxFor).HasColumnName("FAmountIncludeTaxFor");
            this.Property(t => t.FAddCost).HasColumnName("FAddCost");
            this.Property(t => t.FAddCostFor).HasColumnName("FAddCostFor");
            this.Property(t => t.FBusinessDiscount).HasColumnName("FBusinessDiscount");
            this.Property(t => t.FBusinessDiscountFor).HasColumnName("FBusinessDiscountFor");
            this.Property(t => t.FBusinessDiscountRate).HasColumnName("FBusinessDiscountRate");
            this.Property(t => t.FExplanation).HasColumnName("FExplanation");
            this.Property(t => t.FBatchNo).HasColumnName("FBatchNo");
            this.Property(t => t.FFreeItem1).HasColumnName("FFreeItem1");
            this.Property(t => t.FFreeItem2).HasColumnName("FFreeItem2");
        }
    }
}
